Skip to content

Conversation

vinay-deshmukh
Copy link
Contributor

@vinay-deshmukh vinay-deshmukh commented Apr 4, 2025

Fixes #128660

Depends on:

  1. [NFC][libc++] Fix typo in libcxx/include/__memory/pointer_traits.h #157304
  2. [libc++] Remove UB from std::__tree_node construction #153908

Summary:

  1. Apply _LIBCPP_CONSTEXPR_SINCE_CXX26 to map, __tree, node-handle, __libcpp_erase_if, __lazy_synth_three_way_comparator, __lazy_compare_result, libcxx/include/__utility/try_key_extraction.h

  2. Skip test erase_if.pass.cpp for GCC during constant evaluation. AFAICT this appears to be a g++ bug, as the test passes with clang

  3. Disable test for node-handle::key() during constant evaluation (CWG2514). It is annotated with a // FIXME

  4. map.modifiers/try.emplace.pass.cpp : Start using the previously unused mv3. (Should this be a separate patch?)

  5. Has a TODO for multimap and ohters
    a. libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
    b. libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
    a. libcxx/test/std/containers/container.node/node_handle.pass.cpp

  6. Fix typo in libcxx/include/__memory/pointer_traits.h -> [NFC][libc++] Fix typo in libcxx/include/__memory/pointer_traits.h #157304

  7. pair<const MoveOnly, ...>
    a. move_assign.pass.cpp
    b. move_alloc.pass.cpp
    c. Fails to compile if static_assert(test()); is called in the test file
    d. Has a // FIXME with commented code

  8. Change __tree_node to construct it's __node_value_type during construction to avoid the: note: member call on object outside its lifetime is not allowed in a constant expression issue. This became -> [libc++] Remove UB from std::__tree_node construction #153908

Copy link

github-actions bot commented Apr 4, 2025

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

Copy link

github-actions bot commented Apr 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128660-P3372-constexpr-map branch 2 times, most recently from 46d0bb9 to 9ea718f Compare April 7, 2025 22:25
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128660-P3372-constexpr-map branch from 01dc888 to 5c84f1f Compare October 2, 2025 13:30
@vinay-deshmukh
Copy link
Contributor Author

vinay-deshmukh commented Oct 2, 2025

  1. Windows / clang-cl builds are failing due to:
note: non-literal type 'std::__tree_node<std::__value_type<int, double>, void *>' cannot be used in a constant expression

Which may be due to C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe being an older version (<=19) similar to the arm issue discussed earlier.

This may get fixed by #161736

  1. There's a similar issue for macos builds , which use AppleClang 17.0.0.17000319 which is probably old(er?) than clang 19.x. Not sure who the right person is to ping out that

@vinay-deshmukh
Copy link
Contributor Author

macos builds appear to be failing due to an unrelated issue:

https://github.com/llvm/llvm-project/actions/runs/18238483208/job/51938026500?pr=134330

 # | /Users/runner/work/llvm-project/llvm-project/build/apple-system-hardened/cxx/libcxx/test-suite-install/include/c++/v1/experimental/__simd/vec_ext.h:95:91: error: cannot initialize a member subobject of type '__attribute__((__vector_size__(8 * sizeof(unsigned char)))) unsigned char' (vector of 8 'unsigned char' values) with an rvalue of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values)
  # |    95 |   static _LIBCPP_HIDE_FROM_ABI _MaskStorage __negate(_SimdStorage __s) noexcept { return {!__s.__data}; }
  # |       |                                                                                           ^~~~~~~~~~~
  # | /Users/runner/work/llvm-project/llvm-project/build/apple-system-hardened/cxx/libcxx/test-suite-install/include/c++/v1/experimental/__simd/simd.h:134:29: note: in instantiation of member function 'std::experimental::__simd_operations<char, std::experimental::simd_abi::__vec_ext<8>>::__negate' requested here
  # |   134 |     return mask_type(_Impl::__negate(__s_), mask_type::__storage_tag);
  # |       |                             ^
  # | /Users/runner/work/llvm-project/llvm-project/libcxx/test/std/experimental/simd/simd.class/simd_unary.pass.cpp:113:47: note: in instantiation of member function 'std::experimental::simd<char, std::experimental::simd_abi::__vec_ext<8>>::operator!' requested here
  # |   113 |     assert_simd_mask_values_equal<array_size>(!origin_simd, expected_value);
  # |       |                                               ^
  # | /Users/runner/work/llvm-project/llvm-project/libcxx/test/support/type_algorithms.h:52:23: note: in instantiation of function template specialization 'CheckSimdNegationOperator<char, 8>::operator()<std::experimental::simd_abi::__vec_ext<8>>' requested here
  # |    52 |   swallow((f.template operator()<Types>(), 0)...);
  # |       |                       ^
  # | /Users/runner/work/llvm-project/llvm-project/libcxx/test/std/experimental/simd/simd.class/../test_utils.h:40:5: note: in instantiation of function template specialization 'TestAllSimdAbiFunctor<CheckSimdNegationOperator>::instantiate_with_n<char, 1UL, 2UL, 3UL, 4UL, 8UL, 16UL, 30UL, 31UL, 32UL>' requested here
  # |    40 |     instantiate_with_n<T>(
  # |       |     ^
  # | /Users/runner/work/llvm-project/llvm-project/libcxx/test/support/type_algorithms.h:52:23: note: in instantiation of function template specialization 'TestAllSimdAbiFunctor<CheckSimdNegationOperator>::operator()<char>' requested here
  # |    52 |   swallow((f.template operator()<Types>(), 0)...);
  # |       |                       ^
  # | /Users/runner/work/llvm-project/llvm-project/libcxx/test/std/experimental/simd/simd.class/simd_unary.pass.cpp:184:3: note: in instantiation of function template specialization 'test_all_simd_abi<CheckSimdNegationOperator>' requested here
  # |   184 |   test_all_simd_abi<CheckSimdNegationOperator>();
  # |       |   ^
  # | In file included from /Users/runner/work/llvm-project/llvm-project/libcxx/test/std/experimental/simd/simd.class/simd_unary.pass.cpp:30:
  # | In file included from /Users/runner/work/llvm-project/llvm-project/libcxx/test/std/experimental/simd/simd.class/../test_utils.h:15:
  # | In file included from /Users/runner/work/llvm-project/llvm-project/build/apple-system-hardened/cxx/libcxx/test-suite-install/include/c++/v1/experimental/simd:89:

@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128660-P3372-constexpr-map branch from ff27195 to 29acf01 Compare October 5, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++26 libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc++] P3372R3: constexpr map
5 participants